Publish raw payload

Daniel O'Connor %!s(int64=10) %!d(string=hace) años
padre
commit
8d2cfc8456
Se han modificado 1 ficheros con 7 adiciones y 12 borrados
  1. 7 12
      app/models/agents/google_calendar_publish_agent.rb

+ 7 - 12
app/models/agents/google_calendar_publish_agent.rb

@@ -1,7 +1,5 @@
1 1
 module Agents
2 2
   class GoogleCalendarPublishAgent < Agent
3
-    include LiquidInterpolatable
4
-
5 3
     cannot_be_scheduled!
6 4
 
7 5
     description <<-MD
@@ -40,6 +38,8 @@ module Agents
40 38
       
41 39
 
42 40
       Set `expected_update_period_in_days` to the maximum amount of time that you'd expect to pass between Events being created by this Agent.
41
+
42
+      Use it with a trigger agent to shape your payload!
43 43
     MD
44 44
 
45 45
     def validate_options
@@ -63,7 +63,7 @@ module Agents
63 63
         'details' => {
64 64
           'visibility' => 'default',
65 65
           'summary' => "Awesome event",
66
-          'description' => "An example event with {{text}}. Pro tip: DateTimes are in RFC3339",
66
+          'description' => "An example event with text. Pro tip: DateTimes are in RFC3339",
67 67
           'start': {
68 68
             'dateTime': '2014-10-02T10:00:00-05:00'
69 69
           },
@@ -76,24 +76,19 @@ module Agents
76 76
 
77 77
     def receive(incoming_events)
78 78
      incoming_events.each do |event|
79
-        text = interpolate_string(options['message'], event.payload)
80
-        calendar_event = publish text
79
+        calendar = GoogleCalendar.new(options, Rails.logger)
80
+
81
+        calender.publish_as(options['calendar_id'], event.payload)
81 82
 
82 83
         create_event :payload => {
83 84
           'success' => true,
84 85
           'published_calendar_event' => text,
85
-          'tweet_id' => calendar_event.id,
86
+          'google_calendar_event_id' => calendar_event.id,
86 87
           'agent_id' => event.agent_id,
87 88
           'event_id' => event.id
88 89
         }
89 90
       end
90 91
     end
91
-
92
-    def publish(text)
93
-      calendar = GoogleCalendar.new(options, Rails.logger)
94
-
95
-      calender.publish_as(options['calendar_id'], text)
96
-    end
97 92
   end
98 93
 end
99 94